<!-- Main content -->
<section class="content">
	<div class="row">
		<!-- right column -->
		<div class="col-md-12">
		
			<!-- general form elements disabled -->
			<div class="box box-alegro">
			
				<div class="box-body">
					<form role="form" method="post" action="<?php echo base_url('cliente/adicionar'); ?>">
						<?php 
							if (validation_errors()) {
								$html = '<div class="alert alert-danger alert-dismissable">
											<i class="fa fa-warning"></i>' . validation_errors() . '</div>';
								echo $html;
							}
							if ($this->session->flashdata('error')){
								$html = '<div class="alert alert-danger alert-dismissable">
											<i class="fa fa-check"></i>' . $this->session->flashdata('error') . '</div>';
								echo $html;
							}
							if ($this->session->flashdata('adicionarok')){
								$html = '<div class="alert alert-success alert-dismissable">
											<i class="fa fa-check"></i>' . $this->session->flashdata('adicionarok') . '</div>';
								echo $html;
							}
							//echo form_hidden('Vendedor', $vendedor);
							//echo form_hidden('Cliente', 0);
						?>
						<!-- text input -->
						<?php
						if ( !isset($vendedor) || $vendedor == "" || $vendedor == NULL) {
							$vendedor = $this->session->userdata("codigo_singem");
						?>
							<input type="hidden" name="Vendedor" value="<?php echo $vendedor; ?>" />
						<?php } ?>
						
						<div class="row">
							<div class="form-group col-md-5">
								<label>Nome</label> 
								<!-- 
								<input type="text" name="cli_nome" value="{cli_nome}" class="form-control" placeholder="Nome do Cliente" />
								 -->
								<?php 
								echo form_input(array('name'=>'Nome', 'maxlength' => '50', 'class'=>'form-control', 'placeholder'=>'Nome do Cliente'),set_value('Nome'),'autofocus');
								?>
							</div>
							<div class="form-group col-md-4">
								<label>Endereço</label> 
								<!-- 
								<input type="text" name="cli_endereco" class="form-control" placeholder="Endereço" />
								 -->
								<?php 
								echo form_input(array('name'=>'Endereco', 'maxlength' => '100', 'class'=>'form-control', 'placeholder'=>'Endereço'),set_value('Endereco'));
								?>
							</div>
							<div class="form-group col-md-3">
								<label>Complemento</label> 
								<!-- 
								<input type="text" name="cli_complemento" class="form-control" placeholder="Complemento" />
								 -->
								<?php 
								echo form_input(array('name'=>'Complemento', 'maxlength' => '50', 'class'=>'form-control', 'placeholder'=>'Complemento'),set_value('Complemento'));
								?>
							</div>
						</div>
						
						<div class="row">
							<div class="form-group col-md-3">
								<label>Bairro</label>
								<!-- 
								<input type="text" name="cli_bairro" class="form-control" placeholder="Bairro" />
								 -->
								<?php 
								echo form_input(array('name'=>'Bairro', 'maxlength' => '30', 'class'=>'form-control', 'placeholder'=>'Bairro'),set_value('Bairro'));
								?> 
							</div>
							<div class="form-group col-md-2">
								<label>UF</label> 
								<?php 
								//$estados = array('0'=>'Selecione um Estado', $estados);
								//echo form_dropdown('est_codigo', $estados, 17, 'class="form-control"');
								echo form_input(array('name'=>'UF', 'maxlength' => '2', 'class'=>'form-control', 'placeholder'=>'UF'),set_value('UF'));
								?>
							</div>
							<div class="form-group col-md-3">
								<label>Cidade</label> 
								<?php 
								//$cidade = array('1'=>'Recife', '2'=>'Olinda', '3'=>'Moreno', '4'=>'Carpina', '5'=>'Joboatão dos Guararapes',);
								//echo form_dropdown('cid_codigo', $cidades, 3236, 'class="form-control"');
								echo form_input(array('name'=>'Cidade', 'maxlength' => '30', 'class'=>'form-control', 'placeholder'=>'Cidade'),set_value('Cidade'));
								?>
							</div>
							<div class="form-group col-md-2">
								<label>CEP</label> 
								<!-- 
								<input type="text" name="cli_cep" class="form-control" placeholder="CEP" />
								 -->
								<?php 
								echo form_input(array('id'=>'cep', 'name'=>'CEP', 'maxlength' => '15', 'class'=>'form-control', 'placeholder'=>'CEP'),set_value('CEP'));
								?>
							</div>
							<div class="form-group col-md-2">
								<label>Tipo de Cliente</label> 
								<!-- 
								<select name="tpcli_tipo" class="form-control">
									<option value="1">Pessoa Física</option>
									<option value="2">Pessoa Jurídica</option>
								</select>
								 -->
								<?php 
								$tipo = array('F'=>'Pessoa Física', 'J'=>'Pessoa Jurídica',);
								echo form_dropdown('Tipo',$tipo, set_value('Tipo'), 'class="form-control" id="tipo"');
								?>
							</div>
						</div>
						
						<div class="row">
							<div class="form-group col-md-4">
								<label>Nome Fantasia</label>
								<!-- 
								<input type="text" name="cli_fantasia" class="form-control" placeholder="Nome Fantasia" />
								 -->
								<?php 
								echo form_input(array('name'=>'Fantasia', 'maxlength' => '50', 'class'=>'form-control', 'placeholder'=>'Nome Fantasia'),set_value('Fantasia'));
								?>
							</div>
							<div class="form-group col-md-3">
								<label>Inscrição</label> 
								<!-- 
								<input type="text" name="cli_inscricao" class="form-control" placeholder="Inscrição" />
								 -->
								<?php 
								echo form_input(array('name'=>'Inscricao', 'maxlength' => '20', 'class'=>'form-control', 'placeholder'=>'Inscrição'),set_value('Inscricao'));
								?>
							</div>
							<div class="form-group col-md-3">
								<div id="linha-cpf">
									<label>CPF</label> 
									<!-- 
									<input type="text" name="cli_cgc" class="form-control" placeholder="CGC" />
									 -->
									<?php 
									echo form_input(array('id'=>'cpf', 'name'=>'CGC', 'maxlength' => '20', 'class'=>'form-control', 'placeholder'=>'CPF'),set_value('CGC'));
									?>
								</div>
								<div id="linha-cnpj" style="display: none;">
									<label>CNPJ</label> 
									<!-- 
									<input type="text" name="cli_cgc" class="form-control" placeholder="CGC" />
									 -->
									<?php 
									echo form_input(array('id'=>'cnpj', 'name'=>'CGC_2', 'maxlength' => '20', 'class'=>'form-control', 'placeholder'=>'CNPJ'),set_value('CGC'));
									?>
								</div>
							</div>
						</div>
						
						<div class="row">
							<div class="form-group col-md-4">
								<label>Contato</label> 
								<!-- 
								<input type="text" name="cli_contato" class="form-control" placeholder="Contato" />
								 -->
								<?php 
								echo form_input(array('name'=>'Contato', 'maxlength' => '50', 'class'=>'form-control', 'placeholder'=>'Contato'),set_value('Contato'));
								?>
							</div>
							<div class="form-group col-md-3">
								<label>Fone</label> 
								<!-- 
								<input type="text" name="cli_fone" class="form-control" placeholder="Fone" />
								 -->
								<?php 
								echo form_input(array('name'=>'Fone', 'maxlength' => '30', 'class'=>'form-control', 'placeholder'=>'Fone'),set_value('Fone'));
								?>
							</div>
							<div class="form-group col-md-3">
								<label>E-mail</label> 
								<!-- 
								<input type="text" name="cli_email" class="form-control" placeholder="E-mail" />
								 -->
								<?php 
								echo form_input(array('name'=>'EMail', 'maxlength' => '50', 'class'=>'form-control', 'placeholder'=>'E-mail'),set_value('EMail'));
								?>
							</div>
						</div>
						
						<div class="row">
							<!-- textarea -->
							<div class="form-group col-md-12">
								<label>Observação</label>
								<!-- 
								<textarea name="Observacoes" class="form-control" rows="3" placeholder="Digite aqui uma observação"></textarea>
								 -->
								<?php
								echo form_textarea(array('name'=>'Observacoes', 'maxlength' => '100', 'class'=>'form-control', 'rows'=>'3', 'placeholder'=>'Digite aqui uma observação'),set_value('Observacoes'));
								?>
							</div>
						</div>

						<button type="submit" class="btn btnAdminAlegro">{botaopadrao}</button>
						<button type="reset" class="btn btnAdminAlegro">{botaolimpar}</button>
						<button type="button" class="btn btnAdminAlegro" onClick="history.go(-1)">{botaocancelar}</button>
					</form>
				</div>
				<!-- /.box-body -->
				
			</div>
			<!-- /.box -->
		</div>
		<!--/.col (right) -->
	</div>
	<!-- /.row -->
</section>
<!-- /.content -->
